package ${packageName}.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;



@Entity
@Table(name = "${table.tableName}")
public class ${table.entityName} implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Id
	<#if table.pk.isAutoIncrement>@GeneratedValue(strategy = GenerationType.AUTO)</#if>
	private ${table.pk.javaType} ${table.pk.fieldName};

<#list table.columns as column>
	/**
	 * ${column.comment}
	 */
	<#if column.isKey==false>
	<#if column.javaType=='String'>
	@Length(max = ${column.size})
	</#if>
	<#if column.javaType=='String' && column.nullable==false>
	@NotBlank
	</#if>
	@Column(<#if column.javaType!="byte[]">length = ${column.size}</#if><#if column.nullable==false>,nullable =false</#if>)
	<#if column.sqlType == "DATE">
	@Temporal(TemporalType.DATE)
	<#elseif column.sqlType == "DATETIME">
	@Temporal(TemporalType.TIMESTAMP)
	<#elseif column.sqlType == "TIME">
	@Temporal(TemporalType.TIME)
	<#elseif column.sqlType == "TIMESTAMP">
	@Temporal(TemporalType.TIMESTAMP)
	</#if>
	private ${column.javaType} ${column.fieldName};
	
	</#if>	
</#list>
	
<#list table.columns as column>
	/**
	 * set${column.comment}
	 */
	public void ${column.setMethod}(${column.javaType} ${column.fieldName}){
		this.${column.fieldName} = ${column.fieldName};
	}
	
	/**
	 * get${column.comment}
	 */
	public ${column.javaType} ${column.getMethod}(){
		return this.${column.fieldName};
	}
		
</#list>
}
